<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    response.setHeader("Pragma", "no-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <link rel="stylesheet" href="<%=request.getContextPath()%>/style/style.css" type="text/css"/>
        <title>byAMFI - Products</title>
    </head>
    <body id="bodyManagement">

        <div id="managementMenu">
            <a class="managementLink" href="../category/overview">CATEGORIES</a>
            |  <a class="managementLink" href="../products/overview" style="font-size: 17px;"><b>PRODUCTS</b></a>
            |  <a class="managementLink" href="../brand/overview">BRANDS</a>
        </div>
            
        <div id="overview">
            
            <c:choose>

                <c:when test="${amountOfProducts != 0}">
                    
                    <table>
                        
                        <!--Wanneer er gebruikers opgeslagen zijn, worden ze hier getoond--> 
                        <c:forEach var="tempProduct" items="${productList}">
                            <tr>
                                <td>
                                    <p style="text-align: center;"> ${tempProduct.product_name}</p>
                                </td>
                                
                                <td>
                                    <img style="height:50px;"src="<%=request.getContextPath()%>/products/uploads/${tempProduct.product_image}"/>
                                </td>
                                
                                <td>
                                    <a href="edit?productid=${tempProduct.product_id}">
                                        <img src="../../style/images/button_edit.png" width="20" height="20" />
                                    </a>
                                    
                                    <a href="javascript:if(confirm('Are you sure you want to delete this product?'))window.location='${url}delete?id=${tempProduct.product_id}';" class="icon delete">
                                        <img src="../../style/images/button_remove.png" width="20" height="20" />
                                    </a>
                                </td>
                            </tr>
                        </c:forEach>


                    </table>
                </c:when>

                <c:otherwise>
                    <!-- Als er geen gebruikers zijn, wordt deze melding getoond -->
                    <div class="errormessage">
                        <p>No products found.</p>
                    </div>
                </c:otherwise>

            </c:choose>

        </div><!-- total wrapper close -->
        
        <div id="centeredButton">
                
                <a href="../products/new">
                    <img src="../../style/images/button_NewProduct.png" width="110" height="30"/>
                </a>
                
        </div>
        
    </body>
</html>
